home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / SCRIPTZ / BACON.ZIP / bacon.tcl < prev    next >
Text File  |  1997-02-09  |  58KB  |  1,944 lines

  1. #READ THE README.TXT FILE!
  2. set bacon-dir "/home/flizzo/egg/scripts/"
  3. set ctcp-finger "no no no, none of that kinky stuff here"
  4. set ctcp-version "BitchX-69p1 by panasync : Keep it to yourself!"
  5. set ctcp-cdcclist "Sorry, no packs offered."
  6. #_this is used for (public)version, change only if you got a mod'd egg
  7. #_thats been renamed, such as stealth or bongdrop
  8. set eggname "Eggdrop"
  9. #_one of these lines will be used with (public)away if you dont give an
  10. #_away message along with it
  11. proc random_away {} {
  12.   #** You can add your own away messages below **#
  13.  set aways {
  14.   "gotta go to the bathroom"
  15.   "brb"
  16.   "need some food"
  17.  }
  18. return [lindex $aways [rand [llength $aways]]]
  19. }
  20. #_these are used for (public)ping when you dont specify a nick to ping
  21. #_this will show one of these lines in the channel
  22. proc random_ping {} {
  23.   #** You can add your own ping messages below **#
  24.  set replies {
  25.   "ping pong the witch is dead..."
  26.   "(((*((*(*PONG*)*))*)))"
  27.   "w00p w00p, you have pinged... therefore i have ponged"
  28.   "Dooooo000000000OOOOOOOO000000oooooNG!, oops i mean pong"
  29.   "pong or booooooooooooiiiiiinnnnnnnggggg!"
  30.   "why for art thou ping0ring me"
  31.   "to pong, or not to pong, that is the question"
  32.   "bLooooooOAAAAAAAAAAaaaaawwwwwwWWWWWWWWWWWWW!"
  33.  }
  34.  return [lindex $replies [rand [llength $replies]]]
  35. }
  36. #
  37. #-----By editing anything below this line is violating the US law. You can
  38. #-----face up to 5 years in prison and/or a $10,000 fine. Also if you edit
  39. #-----anything and the script doesn't work right, ITS YOUR FAULT!
  40. #------------------------------- -flizzo
  41. append toolkit_loaded ""
  42. if {$toolkit_loaded != 1} {
  43. putlog "Toolkit.tcl must be loaded"
  44. putlog "  before you attempt to"
  45. putlog "    load Bacon.TCL"
  46. return 0
  47. }
  48. set tver_ [string range [info tclversion] 0 2];set tver ""
  49. append tver [string range $tver_ 0 0] [string range $tver_ 2 2]
  50. if {$tver < "75"} {
  51. putlog "INFO! TCL7.5 or above is NOT"
  52. putlog "present! If you get any TCL"
  53. putlog "errors, don't come to me for"
  54. putlog "help.  -flizzo"
  55. }
  56. set B ".!Bacon!."
  57. #\002-Bold \037-Underline \026-Reverse
  58. append banned-words "" ; # dont change this
  59. append lapnum "" ; # dont change this
  60. ##########################################################################
  61. source ${bacon-dir}bacon.cfg
  62. global cmd-char
  63. #fix
  64. proc fix {x} {global cmd-char
  65. return ${cmd-char}$x
  66. }
  67. #isnull
  68. proc isnull {a} {
  69.   if {$a == "" || $a == "{}" || $a == "-help"} {return 1}
  70.  return 0
  71. }
  72. #b
  73. proc b {x} {return "\002$x\002"}
  74. #isbot
  75. proc isbot {x} {global botnick
  76. if {[tolower $x] == [lcase $botnick]} {return 1}
  77. return 0
  78. }
  79. #ischan
  80. proc ischan {c} {
  81. foreach x [channels] {if {[tolower $c] == [tolower $x]} {return 1}}
  82. return 0
  83. }
  84. #nops
  85. proc nops {c} {set y ""
  86.  foreach x [chanlist $c] {
  87.   if {![isop $x $c]} {append y " $x"}
  88.  };return $y
  89. }
  90. proc chops {c} {set y ""
  91. foreach x [chanlist $c] {
  92.  if {[isop $x $c]} {append y " $x"}
  93.  };return $y
  94. }
  95. proc isnop {n c} {if {[isop $n $c] || [isvoice $n $c]} {return 0};return 1}
  96. proc tz {} {return [exec date +%Z]}
  97. proc len {x} {return [string length $x]}
  98. #index
  99. proc index {sub string} {
  100. set l [expr [len $sub] - 1]; set n 0
  101.  while {$n < [len $string]} {
  102.   set ss [string range $string $n [expr $l + $n]]
  103.   if {$ss == $sub} {return $n}
  104.   set n [expr $n + 1]
  105.  }
  106. return 0
  107. }
  108. #
  109. proc mid {string first last} {return  [string range $string $first $last]}
  110. proc right {string num} {return [mid $string [expr $num + 1] end]}
  111. proc left {string num} {return [mid $string 0 [expr $num - 1]]}
  112. proc before {sub string} {return [left $string [index $sub $string]]}
  113. proc after {sub string} {return [right $string [index $sub $string]]}
  114. #isodd
  115. proc isodd {x} {
  116. set num [expr $x * .5]
  117.  if {[isin ".5" $num]} {
  118.   return 1
  119.  } else {return 0}
  120. }
  121. #isin
  122. proc isin {sub string} {
  123. set sub [lcase $sub]
  124. set string [lcase $string]
  125.  return [string match *${sub}* $string]
  126. }
  127. #mytime
  128. proc mytime {} {
  129.  return [clock format [unixtime] -format {%A, %B %d, %Y %l:%M %p %Z}]
  130. }
  131. #
  132. proc len {x} {return [string length $x]}
  133. proc tolower {x} {return [string tolower $x]}
  134. proc lcase {x} {return [string tolower $x]}
  135. proc toupper {x} {return [string toupper $x]}
  136. proc ucase {x} {return [string toupper $x]}
  137. proc notice {n m} {putserv "notice $n :$m"}
  138. proc act {n m} {msg $n "\001ACTION $m\001"}
  139. proc mact {m} {foreach x [channels] {act $x $m}}
  140. proc msg {n m} {puthelp "privmsg $n :$m"}
  141. proc ctcp {n m} {puthelp "privmsg $n :\001${m}\001"}
  142. proc ctcpreply {n m} {putserv "notice $n :\001${m}\001"}
  143. proc mmsg {m} {foreach x [channels] {msg $x $m}}
  144. proc chat {n} {global telnet;msg $n "\001DCC CHAT chat [myip] $telnet\001"}
  145. proc join {c} {putserv "join $c"}
  146. proc part {c} {putserv "part $c"}
  147. proc kick {n c r} {putserv "kick $c $n :$r"}
  148. proc topic {c t} {putserv "TOPIC $c :$t"}
  149. proc op {c n} {putserv "MODE $c +oooo $n"}
  150. #talks
  151. proc talka {x} {
  152.   set x [talkc $x]
  153.   set total [len $x];set cur 0;set text ""
  154.  while {$cur < $total} {
  155.   set letter [mid $x $cur $cur]
  156.   switch [rand 3] {
  157.    0 {set text $text\002$letter\002}
  158.    1 {set text $text\26$letter\26}
  159.    default {set text $text$letter}
  160.   }
  161. incr cur 1
  162.  }
  163. return $text
  164. }
  165. proc talkl {x} {
  166.  set total [len $x];set cur 0;set text ""
  167.  set norm " abcdefghijklmnopqrstuvwxyz"
  168.  set leet " 4b(d3fgh1jk|mn0pqr5+uvwxyz"
  169.  while {$cur < $total} {
  170.   set letter [mid $x $cur $cur]
  171.   set where [index $letter $norm]
  172.   set letter2 [mid $leet $where $where]
  173.   if {$letter2 == " "} {set letter2 $letter}
  174.   set text $text$letter2
  175.   incr cur 1
  176.  }
  177. return $text
  178. }
  179. proc talkc {x} {
  180. set total [len $x];set cur 0;set text ""
  181.  while {$cur < $total} {
  182.   set letter [mid $x $cur $cur]
  183.    if {[isodd $cur]} {set letter [lcase $letter]} else {
  184.     set letter [ucase $letter]}
  185.   set text $text$letter
  186.   incr cur 1
  187.  }
  188. return $text
  189. }
  190. proc talkb {string} {
  191.  set count 0;set length [string length $string];set bw2 ""
  192.  while {$count < $length} {
  193.   set where [expr [expr $length - $count] - 1]
  194.   set bw1 [string range $string $where $where]
  195.   append bw2 $bw1
  196.   incr count 1
  197.  }
  198. return $bw2
  199. }
  200. #motd
  201. proc bacon_motd {} {
  202. global B
  203. putlog "Heres the egg... but theres something missing!"
  204. putlog "... its the $B !!!!!!!!!!!! TCL loaded... ::flizzo::"
  205. }
  206. newflag v
  207. newflag i
  208. newflag g
  209. set ptime 0;append bacon-tcl-loaded 1
  210. #uptime
  211. if {${bacon-tcl-loaded} > 1} {
  212.  set bacon-tcl-loaded 1} else {
  213.   set load-up-time [unixtime]
  214.   set bacon-tcl-loaded 1
  215. }
  216. bacon_motd
  217. #
  218. proc bacon_setup_dcc {i a} {
  219. global chan-modes chan-fun bot-chans bot-users chan-master cmd-char kick-msg
  220. set b [lrange $a 1 end];set a [lindex $a 0]
  221.  switch [lcase $a] {
  222.   1 {
  223.      #Public Chan Modes - chan-modes - binds_chan_modes
  224.      if {${chan-modes} || ${chan-modes} == "on"} {
  225.       set chan-modes 0
  226.       binds_chan_modes 0
  227.      } else {
  228.       set chan-modes 1
  229.       binds_chan_modes 1      
  230.      }
  231.    }
  232.   2 {
  233.      #Bot Channels - bot-chans - binds_channels
  234.      if {${bot-chans} || ${bot-chans} == "on"} {
  235.       set bot-chans 0
  236.       binds_channels 0
  237.      } else {
  238.       set bot-chans 1
  239.       binds_channels 1
  240.      }
  241.    }
  242.   3 {
  243.      #Bot Users - bot-users - binds_users
  244.      if {${bot-users} || ${bot-users} == "on"} {
  245.       set bot-users 0
  246.       binds_users 0
  247.      } else {
  248.       set bot-users 1
  249.       binds_users 1
  250.      }
  251.    }
  252.   4 {
  253.      #Fun Stuff - chan-fun - binds_fun
  254.      if {${chan-fun} || ${chan-fun} == "on"} {
  255.       set chan-fun 0
  256.       binds_fun 0
  257.      } else {
  258.       set chan-fun 1
  259.       binds_fun 1
  260.      }
  261.    }
  262.   5 {
  263.      #Public Masters - chan-master - binds_master
  264.      if {${chan-master} || ${chan-master} == "on"} {
  265.       set chan-master 0
  266.       binds_master 0
  267.      } else {
  268.       set chan-master 1
  269.       binds_master 1
  270.      }
  271.    }
  272.   6 {
  273.      #Command Character - cmd-char - chng_char
  274.      if {[isnull $b]} {
  275.       putdcc $i "Usage: $a \[character\]"
  276.       return 0
  277.      }
  278.      chng_char $b
  279.    }
  280.   7 {
  281.      #Kick Message - kick-msg
  282.      if {[isnull $b]} {
  283.       putdcc $i "Usage: $a \[kick message\]"
  284.       return 0
  285.      }
  286.      set kick_msg $b
  287.    }
  288.   exit {return 1}
  289.   quit {return 1}
  290.   .exit {return 1}
  291.   .quit {return 1}
  292.   default {putdcc $i "Not an option";return 0}
  293.  }
  294.  bacon_save
  295.  show_setup_stuff $i
  296.  return 0
  297. }
  298. proc show_setup_stuff {i} {
  299. global chan-modes chan-fun bot-chans bot-users chan-master cmd-char kick-msg
  300. putdcc $i "Select what you want to toggle (`exit` when done)"
  301. putdcc $i "------------------------------"
  302. putdcc $i "\[#\] description       : current status"
  303. putdcc $i "\[1\] Public Chan Modes : ${chan-modes} -op-deop-ban-unban-..."
  304. putdcc $i "\[2\] Public Bot Chans  : ${bot-chans}  -addchan-delchan-..."
  305. putdcc $i "\[3\] Public Bot Users  : ${bot-users} -adduser-deluser-..."
  306. putdcc $i "\[4\] Public Fun Stuff  : ${chan-fun} -topic-say-whois-..."
  307. putdcc $i "\[5\] Public Masters    : ${chan-master} -save-jump-servers..."
  308. putdcc $i "\[6\] Command Character : ${cmd-char}"
  309. putdcc $i "\[7\] Default Kick Msg  : ${kick-msg}"
  310. putdcc $i ""
  311. }
  312. proc chng_char {x} {
  313. global chan-modes chan-fun bot-chans bot-users chan-master cmd-char kick-msg
  314. set bchar ${cmd-char}
  315.  if {${chan-modes} == "on" || ${chan-modes} == "1"} {
  316.   binds_chan_modes "off"
  317.   set cmd-char $x
  318.   binds_chan_modes "on"
  319.  }
  320. set cmd-char $bchar
  321.  if {${chan-fun} == "on" || ${chan-fun} == "1"} {
  322.    binds_fun "off"
  323.    set cmd-char $x
  324.    binds_fun "on"
  325.  }
  326. set cmd-char $bchar
  327.  if {${bot-chans} == "on" || ${bot-chans} == "1"} {
  328.    binds_channels "off"
  329.    set cmd-char $x
  330.    binds_channels "on"
  331.  }
  332. set cmd-char $bchar
  333.  if {${bot-users} == "on" || ${bot-users} == "1"} {
  334.    binds_users "off"
  335.    set cmd-char $x
  336.    binds_users "on"
  337.  }
  338. set cmd-char $bchar
  339.  if {${chan-master} == "on" || ${chan-master} == "1"} {
  340.    binds_master "off"
  341.    set cmd-char $x
  342.    binds_master "on"
  343.  }
  344. set cmd-char $bchar
  345. binds_always "off"
  346. set cmd-char $x
  347. binds_always "on"
  348. bacon_save
  349. return 1 
  350. }
  351. proc bacon_save {} {global bacon-dir banned-words antipings show-url
  352. global chan-modes chan-fun bot-chans bot-users chan-master cmd-char kick-msg
  353. set save_file [open ${bacon-dir}bacon.cfg w+]
  354. puts $save_file "
  355. #global chan-modes chan-fun bot-chans bot-users chan-master cmd-char kick-msg
  356. #op deop kick ban ; proc = binds_chan_modes
  357. set chan-modes \"${chan-modes}\"
  358. #ping time whois seen ; proc = binds_fun
  359. set chan-fun \"${chan-fun}\"
  360. #addchan delchan ; proc = binds_channels
  361. set bot-chans \"${bot-chans}\"
  362. #adduser deluser chattr ; proc = binds_users
  363. set bot-users \"${bot-users}\"
  364. #jump rehash save ; proc = binds_master
  365. set chan-master \"${chan-master}\"
  366. #default kick message
  367. set kick-msg \"${kick-msg}\"
  368. #command character
  369. set cmd-char \"${cmd-char}\"
  370. #show url on join
  371. set show-url \"${show-url}\""
  372. foreach x [tolower [channels]] {
  373. puts $save_file "channel add $x \{[lrange [channel info $x] 4 end]\}"
  374.  }
  375. puts $save_file "set banned-words \"${banned-words}\""
  376. puts $save_file "set antipings \"${antipings}\""
  377. close $save_file
  378. }
  379. proc dcc_char {h i a} {global cmd-char
  380. if {$a == "" || $a == "{}"} {
  381.  putdcc $i "Command Character: ${cmd-char}"
  382.  return 0
  383. }
  384. if {$a == "-help"} {dcchelp $i "char";return 0}
  385. chng_char [lindex $a 0]
  386. }
  387. proc pub_sets {n u h c a} {
  388. if {![validuser $h]} {return 0}
  389. global chan-modes chan-fun bot-chans bot-users chan-master cmd-char kick-msg
  390. set binds_on ""
  391. if {${chan-modes}} {append binds_on "Chan-Modes "}
  392. if {${chan-fun}} {append binds_on "Chan-Fun "}
  393. if {${bot-chans}} {append binds_on "Bot-Chans "}
  394. if {${bot-users}} {append binds_on "Bot-Users "}
  395. if {${chan-master}} {append binds_on "Chan-Master"}
  396. set bindson ""
  397.  foreach x $binds_on {
  398.   append bindson " | $x"
  399.  }
  400. set binds_on [right $bindson 2]
  401. msg $c "(\002\037Sets\002\037(ON($binds_on)"
  402. return 1
  403. }
  404. proc pub_char {n u h c a} {
  405. if {![validuser $h]} {return 0}
  406. global botnick cmd-char
  407.  if {$a == "" || $a == "{}" } {msg $c "(Character(${cmd-char})"
  408.   return 0
  409.  }
  410.  if {$a == "-help"} {pubhelp $c "char";return 0}
  411.  if {![matchattr $h m]} {return 0}
  412.  if {[lindex $a 1] == "" || [lindex $a 1] == "{}"} {
  413.   chng_char [lindex $a 0]
  414.   msg $c "(Character(${cmd-char})"
  415.   return 1
  416.  }
  417.  if {[lindex $a 1] == $botnick} {
  418.   chng_char [lindex $a 0];msg $c "(Character(${cmd-char})"
  419.   return 1
  420.  }
  421. return 0
  422. }
  423. #  *!* Binds *!* #
  424. #bot-communication binds
  425. bind bot - opreq bot_opreq
  426. #wordkick bind
  427. bind pubm - * word_kick
  428. #quit msg binds
  429. bind sign o * qmsg_sign
  430. bind splt o * qmsg_splt
  431. #auto modes
  432. bind join - * show_url
  433. bind join i * auto_op
  434. bind join v * auto_v
  435. #-
  436. #protection flags
  437. bind mode - "* -o *" auto_reop
  438. bind kick - * no_kick_mn
  439. #-
  440. #flud bindings
  441. bind flud - * flud_prot
  442. #-
  443. #ctcp binds
  444. bind ctcp - * ctcp_reply
  445. bind ctcr - "ping*" showpingreply
  446. #-
  447. #msg binds
  448. bind msg o unban msg_unban
  449. bind msg o unbanme msg_unban
  450. bind msg - whoami msg_whoami
  451. bind msg o channels msg_channels
  452. bind msg o version msg_version
  453. bind msg o chat msg_chat
  454. # -msg
  455. # - dcc binds
  456. bind rcvd - * dcc_done
  457. bind chon - * info_ondcc
  458. bind pub - char pub_char
  459. bind dcc - seen dcc_seen
  460. bind dcc - phelp dcc_phelp
  461. bind dcc o massnote dcc_massnote
  462. bind dcc o ctcp dcc_ctcp
  463. bind dcc o .match dcc_.match
  464. bind dcc o .whois dcc_.whois
  465. bind dcc m body proc_body
  466. bind dcc m char dcc_char
  467. bind dcc m setup bacon_setup_dcc_start
  468. bind dcc m timers dcc_timers
  469. bind dcc m utimers dcc_utimers
  470. bind dcc m killtimer dcc_killtimer
  471. bind dcc m killutimer dcc_killutimer
  472. bind dcc m massop dcc_massop
  473. bind dcc m massdeop dcc_massdeop
  474. bind dcc m schat dcc_schat
  475. bind dcc m addchan dcc_addchan
  476. bind dcc m chanadd dcc_addchan
  477. bind dcc m join dcc_addchan
  478. bind dcc m delchan dcc_delchan
  479. bind dcc m chandel dcc_delchan
  480. bind dcc m part dcc_delchan
  481. bind dcc m chanset dcc_chanset
  482. bind dcc m setchan dcc_chanset
  483. bind dcc m chaninfo dcc_chaninfo
  484. bind dcc m cycle dcc_cycle
  485. bind dcc m addop dcc_addop
  486. bind dcc m ping dcc_ping
  487. bind dcc m addword dcc_addword
  488. bind dcc m delword dcc_delword
  489. bind dcc m words dcc_words
  490. #-
  491. proc binds_always {st} {
  492. if {[lcase $st] == "on" || $st == "1"} {set status "bind"}
  493. if {[lcase $st] == "off" || $st == "0"} {set status "unbind"}
  494. $status pub - [fix sets] pub_sets
  495. }
  496. proc binds_chan_modes {st} {
  497. if {[lcase $st] == "on" || $st == "1"} {set status "bind"}
  498. if {[lcase $st] == "off" || $st == "0"} {set status "unbind"}
  499. $status pub o [fix op] pub_op
  500. $status pub o [fix up] pub_op
  501. $status pub o [fix down] pub_deop
  502. $status pub o [fix deop] pub_deop
  503. $status pub o [fix voice] pub_voice
  504. $status pub o [fix +v] pub_voice
  505. $status pub o [fix unvoice] pub_unvoice
  506. $status pub o [fix -v] pub_unvoice
  507. $status pub o [fix kick] pub_kick
  508. $status pub o [fix k] pub_kick
  509. $status pub o [fix ban] pub_ba
  510. $status pub o [fix +ban] pub_ban
  511. $status pub o [fix addban] pub_ban
  512. $status pub o [fix pban] pub_pban
  513. $status pub o [fix pb] pub_pban
  514. $status pub o [fix +pban] pub_pban
  515. $status pub o [fix unban] pub_unban
  516. $status pub o [fix uban] pub_unban
  517. $status pub o [fix ub] pub_unban
  518. $status pub o [fix rban] pub_unban
  519. $status pub o [fix -ban] pub_unban
  520. $status pub o [fix cmode] pub_cmode
  521. $status pub o [fix bans] pub_bans
  522. $status pub o [fix unkey] pub_unkey
  523. $status pub m [fix massop] pub_massop
  524. $status pub m [fix massdeop] pub_massdeop
  525. $status pub m [fix idlekick] pub_idlekick
  526. }
  527. proc binds_users {st} {
  528. if {$st == "on" || $st == "1"} {set status "bind"}
  529. if {$st == "off" || $st == "0"} {set status "unbind"}
  530. $status pub m [fix adduser] pub_auser
  531. $status pub m [fix auser] pub_auser
  532. $status pub m [fix duser] pub_duser
  533. $status pub m [fix deluser] pub_duser
  534. $status pub m [fix chattr] pub_chattr
  535. $status pub m [fix addbot] pub_addbot
  536. $status pub m [fix delbot] pub_delbot
  537. $status pub m [fix addhost] pub_addhost
  538. $status pub m [fix delhost] pub_delhost
  539. }
  540. proc binds_channels {st} {
  541. if {[lcase $st] == "on" || $st == "1"} {set status "bind"}
  542. if {[lcase $st] == "off" || $st == "0"} {set status "unbind"}
  543. $status pub m [fix addchan] pub_addchan
  544. $status pub m [fix chanadd] pub_addchan
  545. $status pub m [fix join] pub_addchan
  546. $status pub m [fix delchan] pub_delchan
  547. $status pub m [fix chandel] pub_delchan
  548. $status pub m [fix part] pub_part
  549. $status pub m [fix chanset] pub_chanset
  550. $status pub m [fix setchan] pub_chanset
  551. $status pub m [fix chaninfo] pub_chaninfo
  552. }
  553. proc binds_master {st} {
  554. if {[lcase $st] == "on" || $st == "1"} {set status "bind"}
  555. if {[lcase $st] == "off" || $st == "0"} {set status "unbind"}
  556. $status pub m [fix jump] pub_jump
  557. $status pub m [fix servers] pub_servers
  558. $status pub m [fix save] pub_save
  559. }
  560. proc binds_fun {st} {
  561. if {$st == "on" || $st == "1"} {set status "bind"}
  562. if {$st == "off" || $st == "0"} {set status "unbind"}
  563. $status pub o [fix topic] pub_topic
  564. $status pub o [fix t] pub_topic
  565. $status pub o [fix ping] pub_ping
  566. $status pub o [fix time] pub_time
  567. $status pub o [fix date] pub_time
  568. $status pub o [fix whois] pub_whois
  569. $status pub o [fix whoami] pub_whois
  570. $status pub o [fix myflags] pub_myflags
  571. $status pub o [fix flags] pub_myflags
  572. $status pub o [fix chan] pub_chan
  573. $status pub o [fix idle] pub_idle
  574. $status pub o [fix sv] pub_sv
  575. $status pub o [fix ver] pub_sv
  576. $status pub o [fix version] pub_sv
  577. $status pub o [fix binfo] pub_binfo
  578. $status pub o [fix botinfo] pub_binfo
  579. $status pub o [fix match] pub_match
  580. $status pub o [fix bots] pub_bots
  581. $status pub o [fix isbot] pub_isbot
  582. $status pub o [fix say] pub_say
  583. $status pub o [fix msg] pub_msg
  584. $status pub o [fix act] pub_act
  585. $status pub o [fix me] pub_act
  586. $status pub o [fix action] pub_act
  587. $status pub o [fix act2] pub_act2
  588. $status pub o [fix notice] pub_not
  589. $status pub o [fix notice2] pub_not2
  590. $status pub o [fix wall] pub_wall
  591. $status pub o [fix onotice] pub_wall
  592. $status pub o [fix chat] pub_chat
  593. $status pub o [fix find] pub_finduser
  594. $status pub o [fix email] pub_email
  595. $status pub o [fix info] pub_info
  596. $status pub - [fix seen] pub_seen
  597. $status pub - seen pub_seen
  598. $status pub o [fix atalk] pub_talka
  599. $status pub o [fix btalk] pub_talkb
  600. $status pub o [fix ctalk] pub_talkc
  601. $status pub o [fix ltalk] pub_talkl
  602. $status pub o [fix len] pub_len
  603. $status pub o [fix users] pub_users
  604. $status pub o [fix nusers] pub_nusers
  605. $status pub o [fix quitmsg] pub_quitmsg
  606. $status pub o [fix myquit] pub_quitmsg
  607. $status pub o [fix url] pub_url
  608. #+m
  609. $status pub m [fix addword] pub_addword
  610. $status pub m [fix away] pub_away
  611. $status pub m [fix back] pub_back
  612. $status pub m [fix antiping] pub_antiping
  613. $status pub o [fix words] pub_words
  614. $status pub m [fix delword] pub_delword
  615. }
  616. # *!* Binds END *!* #
  617. # _-^-_-------!STOP!-------_-^-_ #
  618. proc bot_opreq {b cmd a} {global botnick
  619. set chan [lindex $a 1]
  620. set nick [lindex $a 0]
  621. if {![botisop $chan] || [isop $nick $chan] || ![onchan $nick $chan]} {return 0}
  622.   putserv "MODE $chan +o $nick"
  623.   return 0
  624. }
  625. proc fixgainops {} {
  626.  foreach channel [channels] {
  627.   channel set $channel need-op "gain-ops $channel"
  628.  }
  629. }
  630. proc gain-ops {chan} {
  631. global botnick
  632. set chops [chops $chan]
  633. if {[isnull $chops]} {
  634.  notice $chan "Hey guys! Wake up!! Leave the chan so we can get ops!!!"
  635.  return 0
  636. }
  637.  foreach x $chops {
  638.   putallbots "opreq $botnick $chan"
  639.   notice $x "Hey! you there? op me f00l!"
  640.  }
  641. }
  642. proc dcc_.whois {h i a} {
  643. set who [lindex $a 0]
  644. if {[isnull $a]} {set who $h}
  645.  if {![validuser $who]} {
  646.   putdcc $i "(Error($who is not a user)"
  647.   return 0
  648.  }
  649. set idle ""
  650. if {[lcase $h] == "*ban"} {
  651.  putdcc $i "(Whois(*ban) (who cares about those lamuhs)"
  652.  return 0
  653. }
  654.  if {[isnull [getemail $h]]} {
  655.   set email "not!set@yet"
  656.  } else {
  657.   set email [getemail $h]
  658.  }
  659. set info ""
  660. set seen [lastseenhand "1" $h]
  661. if {![isnull [getinfo $h]]} {set info [getinfo $h]}
  662. if {[left $info 1] == "@"} {set info [after "@" $info]}
  663. if {[lcase $who] == [lcase $h]} {
  664. set seen ""
  665. }
  666. set url [geturl $h]
  667.  putdcc $i "(Whois($h) (Flags([chattr $h])"
  668.  putdcc $i "(Email($email) $seen"
  669. if {![isnull $info]} { putdcc $i "(Info($info)"}
  670. if {![isnull $url]} { putdcc $i "(URL($url)"}
  671. return 1
  672. }
  673. proc dcc_.match {h i a} {
  674. set flag [lindex $a 0]
  675. set users [userlist $flag]
  676. set tot [llength $users]
  677. putdcc $i "(Users(${flag}/${tot}($users)"
  678. return 1
  679. }
  680. proc dcc_ctcp {h i a} {
  681. if {[isnull [lindex $a 1]]} {dcchelp $i ctcp;return 0}
  682. ctcp [lindex $a 0] [lrange $a 1 end]
  683. return 1
  684. }
  685. proc dcc_words {h i a} {global banned-words
  686. putdcc $i "(Words(${banned-words})"
  687. return 0
  688. }
  689. proc dcc_addword {h i a} {
  690. foreach nw $a {
  691.  if {![addword $a]} {putdcc $i "(Error(AddWord(adding sw)"}
  692. }
  693. return 1
  694. }
  695. proc dcc_delword {h i a} {global banned-words
  696. if {[isnull $a]} {dcchelp $i delword;return 0}
  697. set dw [lcase [lindex $a 0]]
  698. set newwords ""
  699.  if {![isin $dw ${banned-words}]} {
  700.   putdcc $i "(Error($dw is not a banned work)"
  701.   return 0
  702.  }
  703.  foreach w ${banned-words} {
  704.   if {$dw != $w} {append newwords " $w"}
  705.  }
  706. set banned-words $newwords
  707. bacon_save
  708. return 1
  709. }
  710. proc msg_chat {n u h a} {
  711. chat $n
  712. notice $n "DCC Chat request sent to you, '/dcc chat ${botnick}'"
  713. return 1
  714. }
  715. proc auto_reop {n u h c m} {
  716. if {[matchattr $h n]} {return 0}
  717.  if {[lindex $m 0] == "-o" && [matchattr [nick2hand [lindex $m 1] $c] g]} {
  718.   putserv "MODE $c +o [lindex $m 1]"
  719.  }
  720. return 0
  721. }
  722. proc dcc_addop {h i a} {global botnick textdir
  723. if {[isnull $a]} {dcchelp $i addop;return 0}
  724. set hand [lindex $a 0]
  725.  foreach c [channels] {
  726.   if {[onchan $hand $c]} {
  727.    adduser $hand [maskhost [getchanhost $hand $c]]
  728.    chattr $hand +of
  729.    dumpfile $hand ${textdir}/addop
  730.    return 1
  731.   }
  732.  }
  733. putdcc $i "$hand is not on any channels i am on"
  734. return 0
  735. }
  736. proc pub_url {n u h c a} {
  737.  if {[isnull $a]} {
  738.   if {[isnull [geturl $h]]} {seturl $h "http://www.fishnet.net/~vince"}
  739.   msg $c "(\002\037URL\002\037(${h}([geturl $h])"
  740.   return 1
  741.  }
  742. set a0 [lindex $a 0]
  743.  if {[validuser $a0]} {
  744.   if {[isnull [geturl $a0]]} {seturl $a0 "http://www.fishnet.net/~vince"}
  745.   msg $c "(\002\037URL\002\037(${a0}([geturl $a0])"
  746.   return 1
  747.  }
  748. if {![isin "." $a]} {
  749.  msg $c "wtf a url without a '.' in it?"
  750. return 0
  751. }
  752. seturl $h [lindex $a 0]
  753.   msg $c "(\002\037URL\002\037(${h}([geturl $h])"
  754. return 1
  755. }
  756. proc seturl {h u} {
  757. if {$u == "none"} {set u ""}
  758. user-set $h url $u
  759. }
  760. proc geturl {h} {return [user-get $h url]}
  761. proc show_url {n u h c} {global show-url
  762. if {${show-url} != 1} {return 0}
  763. if {![validuser $h]} {return 0}
  764. set url [geturl $h]
  765. if {[isnull $url]} {return 0}
  766. msg $c "(${url})"
  767. return 0
  768. }
  769. proc dcc_cycle {h i a} {
  770. if {[isnull $a]} {return 0}
  771. set chan [lindex $a 0]
  772. if {![ischan $chan]} {return 0}
  773. putserv "PART $chan"
  774. putserv "JOIN $chan"
  775. return 1
  776. }
  777. proc dcc_done {h n p} {
  778. set path $p
  779.  while {[isin "/" $path]} {
  780.   set path [after "/" $path]
  781.  }
  782. set file $path
  783. notice $n "woohoo, thanx to you I know have '${file}'"
  784. return 0
  785. }
  786. proc pub_delword {n u h c a} {global banned-words
  787. set dw [lcase [lindex $a 0]]
  788. set newwords ""
  789.  if {![isin $dw ${banned-words}]} {
  790.   msg $c "(\002\037Error\002\037($dw is not a banned work)"
  791.   return 0
  792.  }
  793.  foreach w ${banned-words} {
  794.   if {$dw != $w} {append newwords " $w"}
  795.  }
  796. msg $c "(\002\037DelWord\002\037($dw)"
  797. set banned-words $newwords
  798. bacon_save
  799. return 1
  800. }
  801. proc pub_words {n u h c a} {global banned-words
  802. msg $c "(\002\037Words\002\037(${banned-words})"
  803. return 1
  804. }
  805. proc addword {w} {global banned-words
  806. set nw [lcase $w]
  807. if {[isin $nw ${banned-words}]} {return 0}
  808. append banned-words " $nw"
  809. bacon_save
  810. return 1
  811. }
  812. proc pub_addword {n u h c a} {
  813. foreach nw $a {
  814.  if {[addword $a]} {msg $c "(\002\037WordKick\002\037(Added(${nw})"}
  815. }
  816. return 1
  817. }
  818. proc word_kick {n u h c a} {global banned-words
  819. if {[matchattr $h m]} {return 0}
  820.  foreach w ${banned-words} {
  821.   if {[isin $w $a]} {putserv "kick $c $n :(WordKick($w)";return 0}
  822.  }
  823. return 0
  824. }
  825. proc qmsg_splt {n u h c} {
  826. user-set $h quitmsg "Server Split"
  827. return 0
  828. }
  829. proc qmsg_sign {n u h c a} {
  830. user-set $h quitmsg $a
  831. return 0
  832. }
  833. proc pub_quitmsg {n u h c a} {
  834. set who $h
  835. if {![isnull $a]} {set who [lindex $a 0]}
  836. if {![validuser $who]} {
  837.  msg $c "(\002\037Error\002\037($who is not a known user)"
  838.  return 0
  839. }
  840. set quit [user-get $who quitmsg]
  841. if {[isnull $quit]} {set quit "no record of quit msg recorded"}
  842. msg $c "(\002\037LastQuitMsg\002\037(${who}(${quit})"
  843. return 1
  844. }
  845. proc auto_v {n u h c} {
  846. if {![botisop $c]} {return 0}
  847. utimer [expr [rand 5] + 2] "doautov $c $n"
  848. return 0
  849. }
  850. proc auto_op {n u h c} {
  851. if {![botisop $c]} {return 0}
  852. utimer [expr [rand 5] + 2] "doautoop $c $n"
  853. return 0
  854. }
  855. proc doautov {c n} {
  856. if {![isop $n $c]} {putserv "MODE $c +v $n"}
  857. return 0
  858. }
  859. proc doautoop {c n} {
  860. if {![isop $n $c]} {putserv "MODE $c +o $n"}
  861. return 0
  862. }
  863. proc info_ondcc {hand idx} {
  864. set info [getinfo $hand]
  865. if {[isnull $info]} {return 0}
  866. if {[left $info 1] == "@"} {set info [after "@" $info]}
  867. set infoline "($hand) $info"
  868. dccbroadcast $infoline
  869. return 0
  870. }
  871. proc no_kick_mn {nick uhost hand chan knick reas} {global botnick
  872. if {[matchattr $hand n]==1 || $nick == $botnick} {return 0}
  873. set khand [nick2hand $knick $chan]
  874.  if {[matchattr $khand n]} {
  875.   putserv "INVITE $knick $chan"
  876.   putserv "KICK $chan $nick :$knick is too leet to be kicked by you"
  877.   return 0
  878.  }
  879. if {[matchattr $khand m] && ![matchattr $hand m]} {
  880.   putserv "INVITE $knick $chan"
  881.   putserv "KICK $chan $nick :$knick is too leet to be kicked by you"
  882.   return 0
  883. }
  884. return 0
  885. }
  886. proc dcc_chaninfo {h i a} {
  887. set r 0
  888. if {[isnull $a]} {dcchelp $i "chaninfo";return 0}
  889. set a [tolower [lindex $a 0]]
  890. if {[left $a 1] != "#"} {set a "#$a"}
  891. foreach x [tolower [channels]] {if {$x == $a} {set r 1}}
  892. if {$r == 0} {putdcc $i "(Error(i am not on $a)";return 0}
  893. set sets [lrange [channel info $a] 4 end]
  894. putdcc $i "(\002\037Chan\002\037(Sets(${a}($sets)"
  895. return 1
  896. }
  897. proc dcc_chanset {h i a} {
  898. set r 0
  899. if {[isnull $a] || [isnull [lindex $a 1]]} {dcchelp $i "chanset";return 0}
  900. set s [lrange $a 1 end];set a [tolower [lindex $a 0]]
  901. if {[left $a 1] != "#"} {set a "#$a"}
  902. foreach x [tolower [channels]] {if {$x == $a} {set r 1}}
  903. if {$r == 0} {
  904.  putdcc $i "(\002\037Error\002\037(i am not on $a)"
  905.  return 0
  906. }
  907. channel set $a $s
  908. putdcc $i "(\002\037Chan\002\037(Sets(${a}([lrange [channel info $a] 4 end])"
  909. bacon_save
  910. return 1
  911. }
  912. proc dcc_delchan {h i a} {
  913. set a [tolower $a]
  914. if {[isnull $a]} {dcchelp $i "delchan";return 0}
  915. if {[left $a 1] != "#"} {set a "#$a"}
  916. if {![ischan $a]} {
  917. putdcc $i "(\002\037Error\002\037(i am not on $a)"
  918. return 0
  919. }
  920. putdcc $i "(\002\037Chan\002\037(Removed($a)"
  921. channel remove $a
  922. bacon_save
  923. return 1
  924. }
  925. proc dcc_addchan {h i a} {
  926. if {[isnull $a]} {dcchelp $i addchan;return 0}
  927. set b [lrange $a 1 end]
  928. set a [lindex $a 0]
  929. if {[left $a 1] != "#"} {set a "#$a"}
  930. channel add $a $b
  931. set sets [lrange [channel info $a] 4 end]
  932. putdcc $i "(\002\037Chan\002\037(Added($a)"
  933. bacon_save
  934. return 1
  935. }
  936. proc ctcp_reply {n u h d k a} {
  937. global ctcp-finger ctcp-version ctcp-cdcclist ctcp-userinfo
  938. set k [lcase $k];set reply ""
  939. if {$k == "finger"} {set reply ${ctcp-finger}}
  940. if {$k == "version"} {set reply ${ctcp-version}}
  941. if {$k == "cdcclist"} {set reply ${ctcp-cdcclist}}
  942. #[lash TIME reply]: Sat Feb 08 00:09:58 1997
  943. if {$k == "time"} {set reply "Time: [mytime]"}
  944. if {$k == "ping"} {return 0}
  945. if {$k == ""} {return 1}
  946. if {$reply == ""} {return 1}
  947. ctcpreply $n $reply
  948. return 1
  949. }
  950. proc pub_nusers {n u h c a} {
  951. set num 0
  952. set nusers ""
  953.  foreach x [chanlist $c] {
  954.   if {![validuser [nick2hand $x $c]]} {
  955.    incr num 1
  956.    append nusers " $x"
  957.   }
  958.  }
  959. msg $c "(\002\037Nusers\002\037($c/${num}($nusers)"
  960. return 1
  961. }
  962. proc pub_users {n u h c a} {
  963. set num 0
  964. set users ""
  965.  foreach x [chanlist $c] {
  966.   if {[validuser [nick2hand $x $c]]} {
  967.    incr num 1
  968.    append users " $x"
  969.   }
  970.  }
  971. msg $c "(\002\037Users\002\037($c/${num}($users)"
  972. return 1
  973. }
  974. proc pub_save {n u h c a} {
  975. save
  976. msg $c "(\002\037Saving...\002\037(done)"
  977. return 1
  978. }
  979. proc bacon_setup_dcc_start {h i a} {control $i bacon_setup_dcc
  980.  putdcc $i "Wecome to the setup script for Bacon!"
  981.  putdcc $i ""
  982.  show_setup_stuff $i
  983. }
  984. proc pub_talka {n u h c a} {msg $c [talka $a]}
  985. proc pub_talkb {n u h c a} {msg $c [talkb $a]}
  986. proc pub_talkc {n u h c a} {msg $c [talkc $a]}
  987. proc pub_talkl {n u h c a} {msg $c [talkl $a]}
  988. proc proc_body {i h a} {putdcc $h [info body $a]}
  989. proc msg_whoami {n u h a} {
  990. if {![validuser $h]} {return 0}
  991.  msg $n "(You(${h}(Flags([chattr $h])"
  992.  return 1
  993. }
  994. proc msg_channels {n u h a} {
  995.  msg $n "(Channels([channels])"
  996.  return 1
  997. }
  998. proc msg_version {n u h a} {global sv;msg $n $sv}
  999. proc msg_unban {n u h a} {
  1000. set anychans 0
  1001. if {$a == "-help"} {msghelp $n unban;return 1}
  1002. foreach c [channels] {
  1003.  foreach x [chanbans $c] {
  1004.   if {[string match $x ${n}!$u] == 1} {
  1005.    putserv "MODE $c -b $x"
  1006.    msg $n "found $x on ${c}, unbanning..."
  1007.    putserv "INVITE $n $c"
  1008.    set anychans 1
  1009.   }
  1010.  }
  1011. }
  1012. if {$anychans != "1"} {
  1013.  msg $n "(Error(no ban matching $u in any channels)"
  1014.  return 0
  1015. }
  1016. return 1
  1017. }
  1018. proc dcc_schat {h i a} {set a [lindex $a 0];global botnick
  1019. if {[isnull $a]} {dcchelp $i "schat";return 0}
  1020. chat $a
  1021. notice $a "DCC Chat request sent to you, '/dcc chat ${botnick}'"
  1022. return 1
  1023. }
  1024. proc pub_idlekick {n u h c a} {
  1025. global kick-msg
  1026. set klist ""
  1027. set time_ [lindex $a 0]
  1028. set time [expr [lindex $a 0] - 1]
  1029. set reason [lrange $a 1 end]
  1030. if {[isnull $reason]} {set reason ${kick-msg}}
  1031. foreach x [nops $c] {if {[getchanidle $x $c] > $time} {append klist "$x "}}
  1032. set cur 1;set tot [llength $klist] 
  1033. foreach x $klist {
  1034. putserv "kick $c $x :(IdleKick(${time_ mins}(${cur}/${tot}($reason)"
  1035. incr cur 1
  1036.  }
  1037. return 1
  1038. }
  1039. proc pub_len {n u h c a} {msg $c "(\002\037Length\002\037(${a}([len $a])"}
  1040. proc pub_talka {n u h c a} {msg $c [talka $a]}
  1041. proc pub_talkb {n u h c a} {msg $c [talkb $a]}
  1042. proc pub_talkc {n u h c a} {msg $c [talkc $a]}
  1043. proc pub_talkl {n u h c a} {msg $c [talkl $a]}
  1044. proc dcc_seen {h i a} {
  1045. if {$a == "-help"} {dcchelp $i "seen";return 0}
  1046. putdcc $i [lastseenhand "$h" $a]
  1047. return 1
  1048. }
  1049. proc pub_seen {n u h c a} {
  1050. if {$a == "-help"} {pubhelp $c "seen";return 0}
  1051. msg $c [lastseenhand $n $a]
  1052. return 1
  1053. }
  1054. proc lastseenhand {n a} {
  1055. set w [lcase [lindex $a 0]]
  1056. if {[isnull $a]} {return "sorry, never seen the invisible man"}
  1057. if {[lcase $n] == [lcase $w]} {return "($w) is some blind lamuh"}
  1058. foreach c [channels] {
  1059. set nick [hand2nick $w $c]
  1060.  if {[lcase $nick] == $n} {
  1061.    return "($w) is some blind lamuh"
  1062.  }
  1063. }
  1064. if {$a == "*ban"} {return "who cares when those lamers were here"}
  1065. if {[isbot $w]} {return "unless i am seeing things, i am right here"}
  1066. foreach x [channels] {
  1067.  if {[onchansplit $w $x]} {
  1068.   return "(\002\037Seen\002\037(${w}(was seen riding a split in $x)"
  1069.  }
  1070. }
  1071. foreach x [channels] {
  1072.  if {[onchan $w $x]} {
  1073.   if {[validuser [nick2hand $w $x]]} {
  1074.    return "(\002\037Seen\002\037($w is on $x)"
  1075.   } else {
  1076.   return "(\002\037Seen\002\037($w is on ${x}, but its a fake)"
  1077.   }
  1078.  }
  1079. }
  1080. foreach c [channels] { 
  1081.  if {[handonchan $w $c]} {
  1082.   return "(\002\037Seen\002\037(${w}(is really [hand2nick $w $c])"
  1083.  }
  1084. }
  1085. if {![validuser $w]} {return "(\002\037Error\002\037(i dont know who $a is)"}
  1086. return [getlastseen $w]
  1087. }
  1088. proc fixtimeago {time} {
  1089. set cur [unixtime]
  1090. set last $time
  1091. set since [expr $cur - $last]
  1092. return [fixmins2stuff $since]
  1093. }
  1094. proc fixmins2stuff {since} {
  1095. set year 0;set month 0;set week 0;set day 0;set hour 0;set min 0
  1096. set years "";set months "";set weeks "";set days "";set hours "";
  1097. set mins "";set secs ""
  1098. while {$since > 31535999} {incr year 1;incr since -31536000}
  1099. #while {$since > 2591999} {incr month 1;incr since -2592000}
  1100. while {$since > 604799} {incr week 1;incr since -604800}
  1101. while {$since > 86399} {incr day 1;incr since -86400}
  1102. while {$since > 3599} {incr hour 1;incr since -3600}
  1103. while {$since > 59} {incr min 1;incr since -60};set sec $since
  1104. if {$year > 1} {set years " $year years "}
  1105. if {$year == 1} {set years "1 year "}
  1106. #if {$month > 1} {set months "$month months "}
  1107. if {$month == 1} {set months "1 month "}
  1108. if {$week > 1} {set weeks "$week weeks "}
  1109. if {$week == 1} {set weeks "1 week "}
  1110. if {$day > 1} {set days "$day days "}
  1111. if {$day == 1} {set days "1 day "}
  1112. if {$hour > 1} {set hours "$hour hours "}
  1113. if {$hour == 1} {set hours "1 hour "}
  1114. if {$min > 1} {set mins "$min minutes "}
  1115. if {$min == 1} {set mins "1 minute "}
  1116. if {$sec > 1} {set secs "$sec seconds "}
  1117. if {$sec == 1} {set secs "1 second "}
  1118. if {$sec == 0} {set secs ""}
  1119. set when "$years$months$weeks$days$hours$mins$secs"
  1120. if {$when == ""} {return ""}
  1121. return [left $when [expr [len $when] - 1]]
  1122. }
  1123. proc getlastseen {h} {
  1124. return "(\002\037Seen\002\037(${h}([fixtimeago [getlaston $h]] ago)"
  1125. }
  1126. #seenend
  1127. proc pub_info {n u h c a} {
  1128. if {[isnull $a]} {
  1129.  msg $c "(\002\037Info\002\037(${h}([getinfo $h])"
  1130.  return 1
  1131. }
  1132. if {[isinfolock $h]} {
  1133.  msg $c "(\002\037Error\002\037(info is locked for $h)"
  1134.  return 0
  1135. }
  1136. if {$a == "none"} {
  1137. setinfo $h ""
  1138. msg $c "(\002\037Info\002\037(${h}(unset)"
  1139. return 1
  1140. }
  1141. setinfo $h $a
  1142. msg $c "(\002\037Info\002\037(${h}([getinfo $h])"
  1143. return 1
  1144. }
  1145. proc pub_email {n u h c a} {
  1146. if {[isnull $a]} {
  1147.  msg $c "(\002\037Email\002\037(${h}([getemail $h])"
  1148.  return 1
  1149. }
  1150. set w [lindex $a 0]
  1151. if {[validuser $w]} {
  1152.  set email [getemail $w]
  1153.  if {[isnull $email]} {set email "not!set@yet"}
  1154.  msg $c "(\002\037Email\002\037(${w}($email)"
  1155.  return 1
  1156. }
  1157. set w [nick2hand $w $c]
  1158. if {[validuser $w]} {
  1159.  set email [getemail $w]
  1160.  if {[isnull $email]} {set email "not!set@yet"}
  1161.  msg $c "(\002\037Email\002\037(${w}($email)"
  1162.  return 1
  1163. }
  1164. setemail $h $a
  1165. msg $c "(\002\037Email\002\037(${h}($a)"
  1166. return 1
  1167. }
  1168. proc flud_prot {n u h t c} {global ignore-time ban-time
  1169. if {$t == "pub"} {
  1170.  kick $n $c "(Public Flood Detected(YOU[b "->"]OUT)"
  1171. }
  1172. if {$t == "msg"} {
  1173.  msg $n "Message Flood detected: Auto Ignore ${ignore-time} mins"
  1174.  newignore [maskhost $u] Bacon "Message Flood" ${ignore-time}
  1175.  putlog "Message flood detected from ${n}, auto ignore"
  1176. }
  1177. if {$t == "join"} {
  1178.  newchanban $c [maskhost $u] Bacon "Join Flood" ${ban-time}
  1179.  putlog "Join Flood detected from ${n}, auto ban"
  1180. }
  1181. if {$t == "ctcp"} {
  1182.  msg $n "CTCP flood detected: Auto Ignore ${ignore-time} mins"
  1183.  newignore [maskhost $u] Bacon "CTCP Flood" ${ignore-time}
  1184.  putlog "CTCP flood detected from ${n}, auto ignore"
  1185. }
  1186. return 1
  1187. }
  1188. proc dcc_massnote {h i a} {global botnick
  1189. if {[isnull [lindex $a 1]]} {dcchelp $i "massnote";return 0}
  1190. set flag [lindex $a 0]
  1191. if {$flag == "+b" || $flag == "b"} {
  1192.  putdcc $i "(Error(why do you want to send bots a note?)"
  1193.  return 0
  1194. }
  1195. set note "[b "!MassNote!:    "][lrange $a 1 end]"
  1196. set who [userlist $flag]
  1197. set num 0
  1198. foreach x $who {
  1199.  if {![isbot $x] && ![matchattr $x b]} {
  1200.   sendnote $h $x $note
  1201.   incr num 1
  1202.  }
  1203. }
  1204. putdcc $i "(MassNote(Complete($num)"
  1205. return 0
  1206. }
  1207. proc dcc_massdeop {h i a} {
  1208. if {[isnull $a]} {dcchelp $i "massdeop";return 0}
  1209. set c [lindex $a 0];if {[left $c 1] != "#"} {set c "#$c"}
  1210. if {![ischan $c]} {putdcc $i "(Error(I am not on $c)";return 0}
  1211. if {![botisop $c]} {putdcc $i "(Error(i am not OPd on $c)";return 0}
  1212. foreach x [chanlist $c] {
  1213.  if {![validuser [nick2hand $x $c]] && [isop $x $c] && ![isbot $x]} {
  1214.   pushmode $c -o $x
  1215.  }
  1216. }
  1217. flushmode $c
  1218. return 1
  1219. }
  1220. proc dcc_massop {h i a} {
  1221. if {[isnull $a]} {dcchelp $i "massop";return 0}
  1222. set c [lindex $a 0];if {[left $c 1] != "#"} {set c "#$c"}
  1223. if {![ischan $c]} {putdcc $i "(Error(I am not on $c)";return 0}
  1224. if {![botisop $c]} {putdcc $i "(Error(i am not OPd on $c)";return 0}
  1225. foreach x [chanlist $c o] {if {![isop $x $c]} {pushmode $c +o $x}}
  1226. flushmode $c
  1227. return 1
  1228. }
  1229. proc dcc_kill_utimer {h i a} {
  1230. if {[isnull $a]} {putdcc $i "Usage: killtimer <timerID>";return 0}
  1231. killutimer [lindex $a 0]
  1232. }
  1233. proc dcc_killtimer {h i a} {
  1234. if {[isnull $a]} {putdcc $i "Usage: killutimer <utimerID>";return 0}
  1235. killtimer [lindex $a 0]
  1236. }
  1237. proc dcc_utimers {h i a} {
  1238. set t [utimers];set num [llength $t];set cn 0
  1239. if {[isnull $t]} {putdcc $i "no utimers";return 0}
  1240. putdcc $i "(#) | Seconds |   ID    | Command"
  1241. foreach x $t {
  1242. incr cn 1
  1243. putdcc $i "($cn) | [lindex $x 0]       | [lindex $x 2] | [lindex $x 1]"
  1244.  }
  1245. }
  1246. proc dcc_timers {h i a} { 
  1247. set t [timers];set num [llength $t];set cn 0
  1248. if {[isnull $t]} {putdcc $i "no timers";return 0}
  1249. putdcc $i "(#) | Minutes |   ID    | Command"
  1250. foreach x $t {
  1251. incr cn 1
  1252. putdcc $i "($cn) | [lindex $x 0]       | [lindex $x 2] | [lindex $x 1]"
  1253.  }
  1254. }
  1255. proc pub_finduser {n u h c a} {global B ; set a [lindex $a 0];set mn ""
  1256. foreach x [userlist] {if {[isin $a $x]} {append mn " $x"}}
  1257. msg $c "(\002\037FindUser\002\037(\*$a\*($mn)"
  1258. return 1
  1259. }
  1260. proc pub_unkey {n u h c a} {
  1261. if {![botisop $c]} {msg $c "(Error(i am not OPd on $c)";return 0}
  1262. if {[isin "k" [getchanmode $c]]} {
  1263.  putserv "mode $c -k [lindex [getchanmode $c] 1]"
  1264.  return 1
  1265. }
  1266. msg $c "(\002\037Error\002\037(there is not a key on $c)"
  1267. return 0
  1268. }
  1269. proc pub_massdeop {n u h c a} {
  1270. if {![botisop $c]} {
  1271.  msg $c "(\002\037Error\002\037(i am not OPd on $c)"
  1272.  return 0
  1273. }
  1274. foreach x [chanlist $c] {
  1275.  if {![validuser [nick2hand $x $c]] && [isop $x $c]} {pushmode $c -o $x}
  1276. }
  1277. flushmode $c
  1278. return 1
  1279. }
  1280. proc pub_massop {n u h c a} {
  1281. if {![botisop $c]} {
  1282.  msg $c "(Error(i am not OPd on $c)"
  1283.  return 0
  1284. }
  1285. foreach x [chanlist $c o] {if {![isop $x $c]} {pushmode $c +o $x}}
  1286. flushmode $c
  1287. return 1
  1288. }
  1289. proc pub_antiping {n u h c a} {global antipings
  1290. if {[isnull $a]} {pubhelp $c "antiping"}
  1291.  if {[lcase [lindex $a 0]] == "off"} {
  1292.   foreach x [timers] {
  1293.    if {[isin "sapmtc" [lindex $x 1]]} {
  1294.     killtimer [lindex $x 2]
  1295.     msg $c "(\002\037Antiping\002\037(is now off)"
  1296.     return 0
  1297.    }
  1298.   }
  1299.  }
  1300. if {[lcase [lindex $a 0]] == "on"} {
  1301.  foreach x [timers] {
  1302.   if {[isin "sapmtc" [lindex $x 1]]} {
  1303.    msg $c "(\002\037Error\002\037(AntiPing(already turned on)"
  1304.    return 0
  1305.   }
  1306.  }
  1307. sapmtc
  1308. return 1
  1309. }
  1310. foreach x [timers] {
  1311.  if {[isin "sapmtc" [lindex $x 1]]} {
  1312.   killtimer [lindex $x 2]
  1313.  }
  1314. }
  1315.  if {[llength $antipings] > 4} {
  1316.   set antipings "[lrange $antipings 1 4] {$a}"
  1317.  } else {
  1318.   append antipings " {$a}"
  1319.  }
  1320. bacon_save
  1321. timer 7 "sapmtc"
  1322. mmsg $a
  1323. return 1
  1324. }
  1325. proc sapmtc {} {global antipings lapnum
  1326. set num [rand [llength $antipings]]
  1327. while {$num != $lapnum} { set num [rand [llength $antipings]] }
  1328. set lapnum $num
  1329. mmsg [lindex $antipings $num]
  1330. timer 7 "sapmtc"
  1331. }
  1332. proc pub_back {n u h c a} {
  1333. putserv "AWAY"
  1334. if {[isnull $a]} {set a "bacon and eggs work for me!"}
  1335. mact "is back ([b $a])"
  1336. return 1
  1337. }
  1338. proc pub_away {n u h c a} {
  1339. if {[isnull $a]} {set a "[random_away]"}
  1340. putserv "AWAY :$a"
  1341. mact "is away: ([b $a])"
  1342. return 1
  1343. }
  1344. proc pub_chat {n u h c a} {
  1345. if {[isnull $a]} {set a $n};set a [lindex $a 0]
  1346. chat $a
  1347. }
  1348. proc pub_wall {n u h c a} {global botnick
  1349. if {![botisop $c]} {
  1350.  msg $c "(\002\037Error\002\037(i am not OPd on $c)"
  1351.  return 0
  1352. }
  1353. if {[isnull $a]} {set a "$n iS tOo eReEt FOr mE"}
  1354. foreach x [chanlist $c] {
  1355. if {[isop $x $c] && $botnick != $x} {notice $x "(OPs($c) $a"}
  1356.  }
  1357. return 1
  1358. }
  1359. proc pub_not2 {n u h c a} {
  1360. if {[isnull [lindex $a 1]]} {notice $c "$n iS tOo eReEt FOr mE";return 0}
  1361. notice [lindex $a 0] [lrange $a 1 end]
  1362. return 1
  1363. }
  1364. proc pub_not {n u h c a} { 
  1365. if {[isnull $a]} {set a "$n iS tOo eReEt FOr mE"}
  1366. notice $c $a
  1367. return 1
  1368. }
  1369. proc pub_act2 {n u h c a} {
  1370. if {[isnull [lindex $a 1]]} {act $c "iS nOt eReEt EnOUgH FOr $n";return 1}
  1371. act [lindex $a 0] [lrange $a 1 end]
  1372. return 1
  1373. }
  1374. proc pub_act {n u h c a} {
  1375. if {[isnull $a]} {set a "iS nOt eReEt EnOUgH FOr $n"}
  1376. act $c $a
  1377. return 1
  1378. }
  1379. proc pub_msg {n u h c a} {
  1380. if {[isnull $a]} {msg $c "$n iS tO eReEt FOr mE";return 0}
  1381. if {[llength $a] < 2} {set a "$c $n iS tO eReEt FOr mE"}
  1382. msg [lindex $a 0] [lrange $a 1 end]
  1383. return 1
  1384. }
  1385. proc pub_say {n u h c a} {
  1386. if {[isnull $a]} {set a "$n iS tO eReEt FOr mE"}
  1387. msg $c $a
  1388. return 1
  1389. }
  1390. proc pub_isbot {n u h c a} {global botnick
  1391. if {[isnull $a]} {pubhelp $c "isbot";return 0}
  1392. set bot [lcase [lindex $a 0]]
  1393. if {[lcase $botnick] == $bot} {
  1394.  msg $c "well theres a no brainer"
  1395.  return 0
  1396. }
  1397. foreach x [bots] {
  1398.  if {[lcase $x] == $bot} {
  1399.   msg $c "(\002\037IsBot\002\037(${bot}(YES)"
  1400.   return 1
  1401.  }
  1402. }
  1403.  msg $c "(\002\037IsBot\002\037(${bot}(NO)"
  1404.  return 1
  1405. }
  1406. proc pub_bots {n u h c a} {
  1407. set num2 [llength [bots]];set num "only myself"
  1408. if {$num2 > 0} {set num "[expr $num2 + 1] Total"}
  1409. msg $c "(\002\037Bots\002\037($num)"
  1410. return 1
  1411. }
  1412. proc pub_match {n u h c a} {
  1413. if {[isnull $a]} {pubhelp $c "match";return 0}
  1414. set a [lindex $a 0]
  1415. set list [userlist $a];set num [llength $list]
  1416. if {![isnull $list]} {msg $c "(Match(+${a}(${num}[b "/"]$list)";return 1}
  1417. msg $c "(\002\037Error\002\037(no users matching +$a)"
  1418. return 0
  1419. }
  1420. proc pub_binfo {n u h c a} {global version server load-up-time eggname
  1421. set num [llength [channels]];set users [llength [userlist]]
  1422. msg $c "(\002\037Ver\002\037($eggname[lindex $version 0]) (\002\037Chans\002\037($num) (\002\037Users\002\037($users)" 
  1423. msg $c "(\002\037Uptime\002\037([fixtimeago ${load-up-time}])"
  1424. return 1
  1425. }
  1426. proc pub_sv {n u h c a} {global sv;msg $c "$sv"}
  1427. proc pub_idle {n u h c a} {global botnick;set botnick [tolower $botnick]
  1428. if {$a == "-help"} {pubhelp "idle";return 0}
  1429. if {[isnull $a]} {msg $c "whose idle?";return 0}
  1430. set n [lcase [lindex $a 0]]
  1431. if {$botnick == $n} {msg $c "i am not idle";return 0}
  1432. if {![onchan $n $c]} {
  1433.  msg $c "(\002\037Error\002\037($n is not on $c)"
  1434.  return 0
  1435. }
  1436. set ci [getchanidle $n $c]
  1437. set extra ""
  1438. if {$ci < 1} {
  1439.  msg $c "(\002\037Idle\002\037(${n}(not even a minute)"
  1440.  return 1
  1441. }
  1442. set ci [expr $ci * 60]
  1443. set ci [fixmins2stuff $ci]
  1444. msg $c "(\002\037Idle\002\037(${n}($ci) $extra"
  1445. return 1
  1446. }
  1447. proc pub_chan {n u h c a} {
  1448. if {$a == "-help"} {pubhelp "chan";return 0};set a [lindex $a 0]
  1449. if {[isnull $a]} {set chan $c} else {set chan $a}
  1450. if {![ischan $chan]} {
  1451.  msg $c "(\002\037Error\002\037(i am not $chan)"
  1452.  return 0
  1453. }
  1454. set mode [getchanmode $chan];set bans [llength [chanbans $chan]];set tot "0"
  1455. set chops "0";set nops "0";set voice "0";set users "0";set nusers "0"
  1456. foreach x [chanlist $chan] {incr tot 1
  1457. if {[isop $x $chan]} {incr chops 1}
  1458. if {[isnop $x $chan]} {incr nops 1}
  1459. if {[isvoice $x $chan] && ![isop $x $chan]} {incr voice 1}
  1460.  if {[nick2hand $x $chan] == "" || [nick2hand $x $chan] == "*"} {
  1461.   incr nusers 1
  1462.  } else {
  1463.   incr users 1
  1464.  }
  1465. }
  1466. msg $c "(\002\037Channel\002\037($chan) (\002\037Mode\002\037($mode) (\002\037Bans\002\037($bans) (\002\037Total\002\037($tot)"
  1467. msg $c "(\002\037Chops\002\037($chops) (\002\037Nops\002\037($nops) (\002\037Voice\002\037($voice) (\002\037Users\002\037($users) (\002\037Non\002\037($nusers)"
  1468. return 1
  1469. }
  1470. proc pub_myflags {n u h c a} {
  1471. if {$a == "-help"} {pubhelp $c "myflags";return 0}
  1472. if {[isnull $a]} {
  1473.  msg $c "(\002\037Flags\002\037(${h}(+[chattr $h])"
  1474.  return 1
  1475. }
  1476. set a [lindex $a 0]
  1477. if {[validuser $a]} {
  1478.  msg $c "(\002\037Flags\002\037(${a}(+[chattr $a])"
  1479.  return 1
  1480. }
  1481. set h [nick2hand $a $c]
  1482. if {[validuser $h]} {
  1483.  msg $c "(\002\037Flags\002\037(${h}(+[chattr $h])"
  1484.  return 1
  1485. }
  1486. return 0
  1487. }
  1488. proc pub_whois {n u h c a} {global botnick
  1489. if {[isnull $a]} {set a $n};set a [tolower [lindex $a 0]]
  1490. if {$a == [tolower $botnick]} {msg $c "well theres a no brainer";return 0}
  1491. if {[validuser $a]} {do_whois $c $n $a;return 1}
  1492. if {[validuser [nick2hand $a $c]]} {
  1493.  msg $c "$a is really [nick2hand $a $c]"
  1494.  do_whois $c $n [nick2hand $a $c]
  1495.  return 1
  1496. }
  1497. msg $c "($a) must be a sausage eater, cause i dont know him"
  1498. return 0
  1499. }
  1500. set eggver [lindex $version 0];set eggpatches [lrange $version 3 end]
  1501. set tclver [info tclversion]
  1502. set bv "(v2.0)"
  1503. set sv "${eggname}${eggver}+Tcl${tclver}+$B$bv ::flizzo::"
  1504. proc do_whois {c n h} {set whom "some lamuh that gives head";set idle ""
  1505. if {[lcase $h] == "*ban"} {
  1506.  msg $c "(\002\037Whois\002\037(*ban(who cares about those lamuhs)"
  1507.  return 0
  1508. }
  1509.  if {[isnull [getemail $h]]} {
  1510.   set email "not!set@yet"
  1511.  } else {
  1512.   set email [getemail $h]
  1513.  }
  1514. set ci [getchanidle [hand2nick $h $c] $c]
  1515. set ci [expr $ci * 60]
  1516. set ci [fixmins2stuff $ci]
  1517. if {[isnull $ci]} {set ci "nope"}
  1518. set info ""
  1519. set seen [lastseenhand "1" $h]
  1520. if {[isin "is on" $seen]} {set seen ""}
  1521. if {![isnull [getinfo $h]]} {set info [getinfo $h]}
  1522. if {[left $info 1] == "@"} {set info [after "@" $info]}
  1523. set ci "(\002\037Idle\002\037($ci)"
  1524.  if {[lcase $n] == [lcase [hand2nick $h $c]]} {
  1525.   set seen ""
  1526.   set ci ""
  1527.  }
  1528. set url [geturl $h]
  1529. msg $c "(\002\037Whois\002\037($h) (\002\037Flags\002\037([chattr $h]) $ci"
  1530. msg $c "(\002\037Email\002\037($email) $seen"
  1531. if {![isnull $info]} {msg $c "(\002\037Info\002\037($info)"}
  1532. if {![isnull $url]} {msg $c "(\002\037URL\002\037($url)"}
  1533. }
  1534. proc isinfolock {h} {
  1535. set info [getinfo $h]
  1536. if {[left $info 1] == "@"} {return 1}
  1537. return 0
  1538. }
  1539. proc pub_time {n u h c a} {msg $c "[mytime]";return 1}
  1540. proc dcc_ping {h i a} {
  1541. ctcp $a "PING [unixtime]"
  1542. return 1
  1543. }
  1544. proc pub_ping {n u h c a} {global botnick
  1545. if {$a == "-help"} {pubhelp $c "ping"}
  1546. if {[isnull $a]} {
  1547. msg $c "[random_ping]";return 1}
  1548. set a [tolower [lindex $a 0]]
  1549.  if {[left $a 1] == "#"} {
  1550.   msg $c "ewww thats gross, the whole chan at once!"
  1551.   return 0
  1552.  }
  1553. ctcp $a "PING [unixtime]"
  1554. return 1
  1555. }
  1556. proc showpingreply {n u h d k a} {
  1557. set n [tolower $n]
  1558. set reptime "[expr [unixtime] - [lindex $a 0]] seconds"
  1559.  mmsg "(\002\037PingReply\002\037(${n}($reptime)"
  1560. #putlog "$n $u $h $d $k $a"
  1561. return 0
  1562. }
  1563. proc pub_delhost {n u h c a} {
  1564. if  {[isnull $a] || [isnull [lindex $a 1]]} {
  1565.  pubhelp $c "delhost"
  1566.  return 0
  1567. }
  1568. set b [lindex $a 1];set a [lindex $a 0]
  1569. if {[validuser $a]} {
  1570.  delhost $a $b
  1571.  msg $c "(\002\037User\002\037(DelHost(${a}($b)"
  1572.  return 1
  1573. }
  1574. if {[validuser [nick2hand $a $c]]} {
  1575.  delhost [nick2hand $a $c] $b
  1576.  msg $c "(\002\037User\002\037(DelHost(${a}($b)"
  1577.  return 1
  1578. }
  1579. msg $c "(\002\037Error\002\037($a is not a user)"
  1580. return 0
  1581. }
  1582. proc pub_addhost {n u h c a} {
  1583. global B
  1584. if {[isnull [lindex $a 1]]} {pubhelp $c "addhost";return 0}
  1585. set b [lindex $a 1];set a [lindex $a 0]
  1586. if {[validuser $a]} {
  1587.  addhost $a $b
  1588.  msg $c "(\002\037User\002\037(AddHost(${a}($b)"
  1589.  return 1
  1590. }
  1591. if {[validuser [nick2hand $a $c]]} {
  1592.  addhost [nick2hand $a $c] $b
  1593.  msg $c "(\002\037User\002\037(AddHost(${a}($b)"
  1594.  return 1
  1595. }
  1596. msg $c "(\002\037Error\002\037(User($a is not a user)"
  1597. return 0
  1598. }
  1599. proc pub_chaninfo {n u h c a} {
  1600. set r 0
  1601. if {$a == "-help"} {pubhelp $c "chaninfo";return 0}
  1602. if {[isnull $a]} {set a $c}
  1603. set a [tolower [lindex $a 0]]
  1604. if {[left $a 1] != "#"} {set a "#$a"}
  1605. foreach x [tolower [channels]] {if {$x == $a} {set r 1}}
  1606. if {$r == 0} {msg $c "(\002\037Error\002\037(i am not on $a)";return 0}
  1607. set sets [lrange [channel info $a] 4 end]
  1608. msg $c "(\002\037Chan\002\037(Sets(${a}($sets)"
  1609. return 1
  1610. }
  1611. proc pub_chanset {n u h c a} {
  1612. set r 0
  1613. if {[isnull $a] || [isnull [lindex $a 1]]} {pubhelp $c "chanset";return 0}
  1614. set s [lrange $a 1 end];set a [tolower [lindex $a 0]]
  1615. if {[left $a 1] != "#"} {set a "#$a"}
  1616. foreach x [tolower [channels]] {if {$x == $a} {set r 1}}
  1617. if {$r == 0} {msg $c "(\002\037Error\002\037(i am not on $a)";return 0}
  1618. channel set $a $s
  1619. msg $c "(\002\037Chan\002\037(Sets(${a}([lrange [channel info $a] 4 end])"
  1620. return 1
  1621. }
  1622. proc pub_delchan {n u h c a} {
  1623. set r 0;set a [tolower $a]
  1624. if {[isnull $a]} {pubhelp $c "delchan";return 0}
  1625. if {[left $a 1] != "#"} {set a "#$a"}
  1626. foreach x [tolower [channels]] {if {$x == $a} {set r 1}}
  1627. if {$r == 0} {msg $c "(\002\037Error\002\037(i am not on $a)";return 0}
  1628. msg $c "(\002\037Chan\002\037(Removed($a)"
  1629. channel remove $a
  1630. bacon_save
  1631. return 1
  1632. }
  1633. proc pub_addchan {n u h c a} {
  1634. if {[isnull $a]} {pubhelp $c "addchan";return 0}
  1635. set b [lrange $a 1 end]
  1636. set a [lindex $a 0]
  1637. if {[left $a 1] != "#"} {set a "#$a"}
  1638. channel add $a $b
  1639. set sets [lrange [channel info $a] 4 end]
  1640. msg $c "(\002\037Chan\002\037(Added($a)"
  1641. bacon_save
  1642. return 1
  1643. }
  1644. proc pub_servers {n u h c a} {
  1645. global servers;set num 1;msg $c "(#) Server"
  1646. foreach x $servers {msg $c "($num) $x";incr num 1}
  1647. }
  1648. proc pub_jump {n u h c a} {
  1649. global B botnick servers
  1650. if {[isnull $a]} {pubhelp $c "jump";return 0}
  1651. if {![isnull [lindex $a 1]] && [lindex $a 1] != $botnick} {return 0}
  1652. if {[string range $a 0 0] == "#"} {
  1653.  set num 1
  1654.  foreach x $servers {
  1655.   if {[isin ":" $x]} {set y [after ":" $x];set x [before ":" $x]}
  1656.   if {$num == [string range $a 1 1]} {jump $x $y;return 1}
  1657.   incr num 1
  1658.   }
  1659.  msg $c "(\002\037Error\002\037(no server #[string range $a 1 1])"
  1660.  return 0
  1661.  }
  1662. if {[isin ":" $x]} {set y [after ":" $x];set x [before ":" $x]}
  1663. jump "$a"
  1664. return 1
  1665. }
  1666. proc pub_delbot {n u h c a} {
  1667. set bot [lindex $a 0]
  1668. if {[isnull $a]} {pubhelp $c "delbot";return 0}
  1669. if {![validuser $bot]} {msg $c "(\002\037Error\002\037($bot is not a user)";return 0}
  1670. if {![matchattr $bot b]} {msg $c "(\002\037Error\002\037($bot is not a bot)";return 0}
  1671. deluser $bot
  1672. msg $c "(\002\037User\002\037(Removed($bot)"
  1673. return 1
  1674. }
  1675. proc pub_addbot {n u h c a} {
  1676. if {[isnull $a] || [isnull [lindex $a 1]]} {pubhelp $c "addbot";return 0}
  1677. set bot [lindex $a 0];set add [lindex $a 1]
  1678. if {[validuser $bot]} {msg $c "(\002\037Error\002\037($bot is already a known user)";return 0}
  1679. if {![isin ":" $add]} {pubhelp $c "addbot";return 0}
  1680. addbot $bot $add
  1681. msg $c "(\002\037User\002\037(Added(${bot}($add as a bot)"
  1682. return 1
  1683. }
  1684. proc pub_chattr {n u h c a} {
  1685. if {$a == "" || $a == "{}" || $a == "-help"} {pubhelp $c "chattr";return 0}
  1686. set b [lindex $a 1]
  1687. set a [lindex $a 0]
  1688. if {[validuser $a]} {
  1689.  chattr $a "+$b"
  1690.  msg $c "(\002\037Chattr\002\037(${a}(+[chattr $a])"
  1691.  return 1
  1692. }
  1693. if {[validuser [nick2hand $a $c]]} {
  1694.  chattr [nick2hand $a $c] "+$b"
  1695.  msg $c "(\002\037FYI\002\037($a is really [nick2hand $a $c])"
  1696.  msg $c "(\002\037Chattr\002\037([nick2hand $a $c](+[chattr [nick2hand $a $c]])"
  1697.  return 1
  1698. }
  1699. msg $c "(\002\037Error\002\037($a is not a known user)"
  1700. return 0
  1701. }
  1702. proc pub_duser {n u h c a} {
  1703. if {$a == "" || $a == "{}" || $a == "-help"} {pubhelp $c "duser";return 0}
  1704. set a [lindex $a 0]
  1705. if {[matchattr $a m] || [matchattr [nick2hand $a $c] m]} {
  1706.  msg $c "(\002\037Error\002\037(cannot remove +m users from channel, use dcc chat)"
  1707.  return 0
  1708. }
  1709. if {[matchattr $a n] || [matchattr [nick2hand $a $c] n]} {
  1710.  msg $c "(\002\037Error\002\037(cannot remove +n users from channel, use dcc chat)"
  1711.  return 0
  1712. }
  1713. if {[validuser $a]} {
  1714.  deluser $a
  1715.  msg $c "(\002\037User\002\037(Removed($a)"
  1716.  return 1
  1717. }
  1718. if {[validuser [nick2hand $a $c]]} {
  1719.  deluser [nick2hand $a $c]
  1720.  msg $c "(\002\037FYI\002\037($a is really [nick2hand $a $c])"
  1721.  msg $c "(\002\037User\002\037(Removed([nick2hand $a $c])"
  1722.  return 1
  1723. }
  1724. msg $c "(\002\037Error\002\037($a is not a known user)"
  1725. return 0
  1726. }
  1727. proc pub_auser {n u h c a} {
  1728. global botnick
  1729. if {$a == "" || $a == "{}" || $a == "-help"} {pubhelp $c "auser";return 0}
  1730. set flags [lindex $a 1]
  1731. set a [lindex $a 0]
  1732. if {[validuser [nick2hand $a $c]]} {
  1733.  msg $c "(\002\037Error\002\037($a is already known as [nick2hand $a $c])"
  1734.  return 0
  1735. }
  1736. if {[validuser $a]} {
  1737.  msg $c "(\002\037Error\002\037(already a user with handle $a)"
  1738.  return 0
  1739. }
  1740. if {![onchan $a $c]} {msg $c "(Error($a is not on $c)";return 0}
  1741. adduser $a [maskhost [getchanhost $a $c]]
  1742. if {[len $flags] > 0} {chattr $a "+$flags"}
  1743. msg $c "(\002\037User\002\037(Added(${a}([chattr $a])"
  1744. msg $a "You have been added to my user list with flags +[chattr $a]"
  1745. msg $a "Please set a password using `/msg $botnick pass [pass]`"
  1746. return 1
  1747. }
  1748. proc pub_pban {n u h c a} {
  1749. global botnick
  1750. if {$a == "" || $a == "{}" || $a == "-help"} {pubhelp "$c" "pban";return 0}
  1751. set ban [lindex $a 0] ; set why [lrange $a 1 end]
  1752. if {$ban == "*!*@*"} {msg $c "(Error(*!*@* not allowed)";return 0}
  1753. if {![isin "!" $ban] || ![isin "@" $ban]} {
  1754. if {[onchan $ban $c]} {
  1755. set ban2 "*!*"
  1756. set mask [string trimleft [maskhost [getchanhost $ban $c]] "*!"]
  1757. set ban $ban2$mask
  1758. }}
  1759. newchanban $c $ban $h $why "0"
  1760. msg $c "(\002\037Ban\002\037(Perm($ban)"
  1761. }
  1762. proc pub_bans {n u h c a} {
  1763. set bans [chanbans $c]
  1764. if {[isnull $bans]} {msg $c "(\002\037Error\002\037(no bans on $c)";return 0}
  1765. msg $c "(#) Ban"
  1766. set num 0
  1767. foreach x $bans {
  1768. set tb [lindex $x 0]
  1769. set num [expr $num + 1]
  1770. set time [fixtime [lindex [ctime [lindex $x 2]] 3]]
  1771. if {[lindex $x 2] == "0"} {set time "(perm)"}
  1772. msg $c "($num) $tb $time"
  1773.  }
  1774. }
  1775. proc fixtime {time} {
  1776. set time [lindex $time 0]
  1777. set hrs [string range $time 0 1]
  1778. if {$hrs > 12} {
  1779. set hrs [expr $hrs - 12]
  1780. return "$hrs[string range $time 2 end] PM"
  1781.  }
  1782. return "[string range $time 1 end] AM"
  1783. }
  1784. proc pub_unban {n u h c a} {
  1785. if {$a == "" || $a == "{}" || $a == "-help"} {pubhelp "$c" "unban";return 0}
  1786. if {![botisop $c]} {msg $c "(Error(i am not OPd on $c)";return 0}
  1787. if {$a == "-all"} {
  1788. foreach x [chanbans $c] {killchanban $c [lindex $x 0]}
  1789. msg $c "(Ban(Removed all bans from $c)"
  1790. return 1
  1791.  }
  1792. if {[string range $a 0 0] == "#"} {
  1793. set bnum [string range $a 1 1]
  1794. set bans [chanbans $c]
  1795. if {$bans == "" || $bans == "{}"} {msg $c "(\002\037Error\002\037(no bans on $c)";return 0}
  1796. set num 0
  1797. foreach x $bans {
  1798. set num [expr $num + 1]
  1799.   if {$bnum == $num} {
  1800.    killchanban $c [lindex $x 0]
  1801.    putserv "MODE $c -b [lindex $x 0]"
  1802.    return 1
  1803.   }
  1804. }
  1805. msg $c "(\002\037Error\002\037(no ban #$a on $c)"
  1806. return 0
  1807.  }
  1808. if {![ischanban $a $c]} {msg $c "(\002\037Error\002\037($a is not a ban on $c)";return 0}
  1809. killchanban $c $a
  1810. msg $c "(Ban(Removed $a from $c)"
  1811. putserv "MODE $c -b $a"
  1812. return 1
  1813. }
  1814. proc pub_cmode {n u h c a} {
  1815. set b [lindex $a 0]
  1816. if {$b == "" || $b == "{}" || $b == "-help"} {pubhelp "$c" "cmode";return 0}
  1817. if {![botisop $c]} {msg $c "(\002\037Error\002\037(i am not OPd on $c)";return 0}
  1818. if {[isin "o" $b]} {msg $c "(\002\037Error\002\037(not for use for OPs)";return 0}
  1819. if {[isin "v" $b]} {msg $c "(\002\037Error\002\037(not for use for voice)";return 0}
  1820. putserv "MODE $c $a"
  1821. return 1
  1822. }
  1823. proc pub_ban {n u h c a} {
  1824. global botnick
  1825. if {$a == "" || $a == "{}" || $a == "-help"} {pubhelp "$c" "ban";return 0}
  1826. set ban [lindex $a 0] ; set why [lrange $a 1 end]
  1827. if {$ban == "*!*@*"} {msg $c "(\002\037Error\002\037(*!*@* not allowed)";return 0}
  1828. if {![isin "!" $ban] || ![isin "@" $ban]} {
  1829. if {[onchan $ban $c]} {
  1830. set ban2 "*!*"
  1831. set mask [string trimleft [maskhost [getchanhost $ban $c]] "*!"]
  1832. set ban $ban2$mask
  1833. }} 
  1834. newchanban $c $ban $h $why
  1835. msg $c "(\002\037Ban\002\037(Temp($ban)"
  1836. }
  1837. proc pub_topic {n u h c a} {
  1838. if {$a == "" || $a == "{}" || $a == "-help"} {pubhelp "$c" "topic";return 0}
  1839. if {![isin "t" [lindex [getchanmode $c] 0]]} {
  1840. msg $c "(\002\037Error\002\037(i am not OPd on $c) but theres no +t so...)"
  1841. topic $c $a
  1842. return 1
  1843. }
  1844. if {![botisop $c]} {msg $c "(Error(i am not OPd on $c)" ; return 0}
  1845. topic $c $a
  1846. return 1
  1847. }
  1848. proc pub_kick {n u h c a} {
  1849. set msg [lrange $a 1 end]
  1850. set n [lcase $n]
  1851. set a [lindex [tolower $a] 0]; global botnick kick-msg
  1852. if {[len $msg] < 1} {set msg ${kick-msg}}
  1853. if {$a == "-help"} {pubhelp "$c" "kick" ; return 0}
  1854. if {$a == ""} {pubhelp "$c" "kick" ; return 0}
  1855. if {$a == "{}"} {pubhelp "$c" "kick" ; return 0}
  1856. if {[isbot $a]} {set a $n}
  1857. if {[matchattr [nick2hand $a $c] m] || [matchattr [nick2hand $a $c] n]} {
  1858.  msg $c "(\002\037Error\002\037($a is too leet to be kicked)"
  1859.  return 0
  1860. }
  1861. if {$a == $n} {
  1862.  msg $c "try /kick $c $a 1 y4m 3r33t"
  1863.  return 0
  1864. }
  1865. if {![botisop $c]} {notice $c "(\002\037Error\002\037(i am not OPd on $c)" ; return 0}
  1866. if {![onchan $a $c]} {msg $c "(\002\037Error\002\037($a is not on $c)" ; return 0}
  1867. putserv "kick $c $a :$msg"
  1868. return 1
  1869. }
  1870. proc pub_unvoice {n u h c a} {
  1871. set a [lindex [tolower $a] 0]; global botnick
  1872. if {$a == "-help"} {pubhelp "$c" "unvoice" ; return 0}
  1873. if {$a == ""} {pubhelp "$c" "unvoice" ; return 0}
  1874. if {$a == "{}"} {pubhelp "$c" "unvoice" ; return 0}
  1875. if {![botisop $c]} {notice $c "(\002\037Error\002\037(i am not OPd on $c)" ; return 0}
  1876. if {![onchan $a $c]} {msg $c "(\002\037Error\002\037($a is no on $c)" ; return 0}
  1877. if {![isvoice $a $c]} {
  1878.  msg $c "(\002\037Error\002\037($a doesnt have voice on $c)"
  1879.  return 0
  1880. }
  1881. putserv "mode $c -v $a"
  1882. return 1
  1883. }
  1884. proc pub_voice {n u h c a} {
  1885. set a [lindex [tolower $a] 0]; global botnick
  1886. if {$a == "-help"} {pubhelp "$c" "voice" ; return 0}
  1887. if {$a == ""} {set a [tolower $n]}
  1888. if {$a == "{}"} {set a [tolower $n]}
  1889. if {![botisop $c]} {notice $c "(\002\037Error\002\037(i am not OPd on $c)" ; return 0}
  1890. if {![onchan $a $c]} {msg $c "(\002\037Error\002\037($a is not on $c)" ; return 0}
  1891. if {[isvoice $a $c]} {
  1892.  msg $c "(\002\037Error\002\037($a is already voiced on $c)"
  1893.  return 0
  1894. }
  1895. putserv "mode $c +v $a"
  1896. return 1
  1897. }
  1898. proc pub_deop {n u h c a} {
  1899. set a [lindex [tolower $a] 0]; global botnick
  1900. if {$a == "-help"} {pubhelp "$c" "deop" ; return 0}
  1901. if {$a == ""} {pubhelp "$c" "deop" ; return 0}
  1902. if {$a == "{}"} {pubhelp "$c" "deop" ; return 0}
  1903. if {[isbot $a]} {set a $n}
  1904. if {![botisop $c]} {notice $c "(\002\037Error\002\037(i am not OPd on $c)" ; return 0}
  1905. if {![onchan $a $c]} {msg $c "(\002\037Error\002\037($a is not on $c)" ; return 0}
  1906. if {![isop $a $c]} {msg $c "(\002\037Error\002\037($a is already deOPd on $c)" ; return 0}
  1907. putserv "mode $c -o $a"
  1908. return 1
  1909. }
  1910. proc pub_op {n u h c a} {
  1911. set a [lindex [tolower $a] 0]
  1912. if {$a == "-help"} {pubhelp "$c" "op" ; return 0}
  1913. if {$a == ""} {set a [tolower $n]}
  1914. if {$a == "{}"} {set a [tolower $n]}
  1915. if {![botisop $c]} {notice $c "(\002\037Error\002\037(i am not OPd on $c)" ; return 0}
  1916. if {![onchan $a $c]} {msg $c "(\002\037Error\002\037($a is not on $c)" ; return 0}
  1917. if {[isop $a $c]} {msg $c "(\002\037Error\002\037($a is already OPd on $c)" ; return 0}
  1918. putserv "mode $c +o $a"
  1919. return 1
  1920. }
  1921. ####HELP STUFF
  1922. proc dcchelp {i t} {
  1923.  putdcc $i "no online help for bacon commands... sorry
  1924. }
  1925. ####HELP END
  1926. # *!* END *!* #
  1927. if {${chan-modes} || ${chan-modes} == "on"} {
  1928.  binds_chan_modes "on"
  1929. }
  1930. if {${chan-fun} || ${chan-fun} == "on"} {
  1931.   binds_fun "on"
  1932. }
  1933. if {${bot-chans} || ${bot-chans} == "on"} {
  1934.  binds_channels "on"
  1935. }
  1936. if {${bot-users} || ${bot-users} == "on"} {
  1937.  binds_users "on"
  1938. }
  1939. if {${chan-master} || ${chan-master} == "on"} {
  1940.  binds_master "on"
  1941. }
  1942. binds_always "on"
  1943. fixgainops
  1944.